﻿namespace EyeOpen.DataEntry.Data.Test
{
	using System;
	using EyeOpen.Data;
	using EyeOpen.DataEntry.Domain;
	using Microsoft.VisualStudio.TestTools.UnitTesting;

	[TestClass]
	public class UnitOfWorkTest
	{
		[TestMethod]
		public void CreateDatabase()
		{
			using (var uow = new ShopUnitOfWork(ProviderHelpers.SqlCe, @"Data Source=EyeOpen.Shop.sdf"))
			{
				if (uow.Database.Exists())
				{
					uow.Database.Delete();
				}

				uow.Database.Create();

				uow.CustomerRepository.Add(new Customer { Id = Guid.NewGuid(), Name = "Bill", Acquired = new DateTime(2000, 1, 1) });

				uow.SaveChanges();
			}
		}
	}
}